package com.atguigu.day10.test15;

public class Test15 {
    public static void meeting(Person... ps){
        for (Person p:ps
             ) {
            p.eat();
            p.toilet();
           if(p instanceof Man){
                ((Man) p).smoke();
           }else if (p instanceof Woman){
               ((Woman) p).makeup();
           }
        }
    }

    public static void main(String[] args) {
        Person[] p = new Person[]{new Man(),new Woman(),new Man(),new Woman(),new Man(),new Man()};
        meeting(new Man(),new Woman(),new Man(),new Woman(),new Man(),new Man());

    }
}
class Person{
    public void eat(){
        System.out.println("吃饭");
    }
    public void toilet(){
        System.out.println("上洗手间");
    }
}
class Man extends Person{
    @Override
    public void eat() {
        super.eat();
    }

    @Override
    public void toilet() {
        super.toilet();
    }
    public void smoke(){
        System.out.println("抽烟");
    }
}
class Woman extends Person{
    @Override
    public void eat() {
        super.eat();
    }

    @Override
    public void toilet() {
        super.toilet();
    }
    public void makeup(){
        System.out.println("化妆");
    }
}